package com.zjuee.base.constant;

/**
 * 省固废平台常量
 *
 * @author wu liang
 * @since 1.0
 */
public interface Common {

    /**
     * 默认密钥
     */
    String KEY = "zjuee/waster";

    /**
     * 对称加密算法
     */
    String KEY_ALGORITHM_AES = "AES";

    /**
     * 非对称加密算法
     */
    String KEY_ALGORITHM_RSA = "RSA";

    /**
     * 默认上传文件的缓存位置
     */
    String TEMP_FILE_PATH = System.getProperty("java.io.tmpdir") + "/dc3/";

    /**
     * 用户主目录
     */
    String USER_HOME_PATH = System.getProperty("user.home") + "/.dc3/";

    /**
     * 时间格式化
     */
    String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

    /**
     * 时区
     */
    String TIMEZONE = "GMT+8";

    /**
     * 默认密码
     */
    String DEFAULT_PASSWORD = "Abc@123456";

    /**
     * 消息常量
     */
    interface Rabbit {
        String TOPIC_EXCHANGE_NOTIFY = "dc3.exchange.driver.notify";
        String TOPIC_EXCHANGE_VALUE = "dc3.exchange.point.value";

        String QUEUE_DRIVER_NOTIFY_PREFIX = "dc3.queue.driver.notify.";
        String QUEUE_DEVICE_STATUS = "dc3.queue.device.status";
        String QUEUE_POINT_SINGLE_VALUE = "dc3.queue.point.single.value";
        String QUEUE_POINT_MULTI_VALUE = "dc3.queue.point.multi.value";

        String ROUTING_DEVICE_NOTIFY_PREFIX = "dc3.routing.device.notify.";
        String ROUTING_DEVICE_STATUS_PREFIX = "dc3.routing.device.status.";
        String ROUTING_SINGLE_VALUE_PREFIX = "dc3.routing.single.value.";
        String ROUTING_MULTI_VALUE_PREFIX = "dc3.routing.multi.value.";
    }

    /**
     * 驱动常量
     */
    interface Driver {
        int MAX_REQUEST_SIZE = 100;
    }

    /**
     * 设备常量
     */
    interface Device {
        String ONLINE = "ONLINE";
        String OFFLINE = "OFFLINE";
        String MAINTAIN = "MAINTAIN";
        String FAULT = "FAULT";
    }

    /**
     * 数据类型
     */
    interface ValueType {
        String HEX = "hex";
        String BYTE = "byte";
        String SHORT = "short";
        String INT = "int";
        String LONG = "long";
        String FLOAT = "float";
        String DOUBLE = "double";
        String BOOLEAN = "boolean";
        String STRING = "string";
    }

    /**
     * 服务名称 & 服务基地址
     */
    interface Service {
        /**
         * zjuee-gateway 服务
         */
        String ZJUEE_GATEWAY_AUTH_USER = "X-Auth-User";
        String ZJUEE_GATEWAY_AUTH_TOKEN = "X-Auth-Token";

        /**
         * zjuee-basic 服务
         */
        String ZJUEE_BASIC_SERVICE_NAME = "zjuee-basic";
        String ZJUEE_BASIC_AREA_URL_PREFIX = "/api/basic/area";
        String ZJUEE_BASIC_DICT_URL_PREFIX = "/api/basic/dict";
        String ZJUEE_BASIC_CAPTCHA_URL_PREFIX = "/api/basic/captcha";
        String ZJUEE_BASIC_FILE_URL_PREFIX = "/api/basic/file";
        String ZJUEE_BASIC_MESSAGE_URL_PREFIX = "/api/basic/message";

        /**
         * zjuee-login 服务
         */
        String ZJUEE_LOGIN_SERVICE_NAME = "zjuee-login";
        String ZJUEE_LOGIN_URL_PREFIX = "/api/login";

        /**
         * zjuee-auth 服务
         */
        String ZJUEE_CO_AUTH_COMPANY_URL_PREFIX = "/co/auth/company";
        String ZJUEE_AUTH_SERVICE_NAME = "zjuee-auth";
        String ZJUEE_AUTH_BLACK_IP_URL_PREFIX = "/api/auth/black/ip";
        String ZJUEE_AUTH_USER_URL_PREFIX = "/api/auth/user";
        String ZJUEE_AUTH_USER_ROLE_URL_PREFIX = "/api/auth/user/role";
        String ZJUEE_AUTH_MENU_URL_PREFIX = "/api/auth/menu";
        String ZJUEE_AUTH_ROLE_URL_PREFIX = "/api/auth/role";
        String ZJUEE_AUTH_ROLE_MENU_URL_PREFIX = "/api/auth/role/menu";
        String ZJUEE_AUTH_ORG_URL_PREFIX = "/api/auth/org";
        String ZJUEE_CO_AUTH_COMPANY_LICENSE_URL_PREFIX = "/co/auth/company/license";

        /**
         * zjuee-co-main 主体服务
         */
        String ZJUEE_CO_MAIN_SERVICE_NAME = "zjuee-co-main-lyw";
        String ZJUEE_CO_MAIN_DEVICE_URL_PREFIX = "/co/main/device";
        String ZJUEE_CO_MAIN_SOURCE_URL_PREFIX = "/co/main/souce";
        String ZJUEE_CO_MAIN_LEDGER_URL_PREFIX = "/co/main/ledger";
        String ZJUEE_CO_MAIN_ORDER_URL_PREFIX = "/co/main/order";
        String ZJUEE_CO_MAIN_PLAN_URL_PREFIX = "/co/main/plan";
        String ZJUEE_CO_MAIN_TPORDER_URL_PREFIX = "/co/main/tporder";
        String ZJUEE_CO_MAIN_HOME_URL_PREFIX = "/co/main/home";
        /**
         * zjuee-timed-task 定时任务服务
         */
        String ZJUEE_TIMED_TASK_SERVICE_NAME = "zjuee-timed-task";
        String ZJUEE_TIMED_TASK_URL_PREFIX = "/api/timed/task";

        /**
         * zjuee-co-warning 预警服务
         */
        String ZJUEE_CO_WARNING_SERVICE_NAME = "zjuee-co-warning";
        String ZJUEE_CO_WARNING_URL_PREFIX = "/co/warning";
        String ZJUEE_CO_WARNING_ALARM_PROMPT_PREFIX ="/co/warning/alarm_prompt";
    }

    /**
     * 缓存Key
     */
    interface Cache {
        /**
         * 基础前缀
         */
        String PREFIX = "sow_app";

        /**
         * token 在 redis 中的失效时间
         */
        int TOKEN_CACHE_TIMEOUT = 12;

        /**
         * 分隔符
         */
        String SEPARATOR = "::";

        String ID = "_id";
        String ID_ID = "id_id";
        String ID_ORG_ID = "id_org_id";
        String IP = "_ip";
        String NAME = "_name";
        String CODE = "_code";
        String STATUS = "_status";
        String VALUE = "_value";
        String VALUES = "_values";
        String DIC = "_dic";
        String LIST = "_list";
        String SALT = "_salt";
        String TOKEN = "_token";
        String LIMIT = "_limit";
        String SERVICE_NAME = "_service_name";
        String HOST_PORT = "_host_port";
        String GROUP_NAME = "_group_name";



        String USER = "user";
        String USER_ROLE = "user_role";
        String ROLE = "role";
        String ROLE_MENU = "role_menu";

        String BLACK_IP = "black_ip";

        String PHONE_CAPTCHA = "phone_captcha";

        /*企业*/
        String COMPANY = "co_";
        /*监管*/
        String GOV = "gov_";
    }

    /**
     * 正则表达式
     */
    interface RegExp {
        // 用户名正则匹配
        public static final String USERNAME_REG = "^[0-9a-zA-Z_\u4e00-\u9fa5]{1,}$";
        public static final String PASSWORD_REG = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])[^ \u4e00-\u9fa5]{8,18}$";

        /**
         * 手机号的正则表达式
         */
        public static final String MOBILE_STRICT = "^1(?:3\\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\\d|9\\d)\\d{8}$";

        /**
         * 邮箱的正则表达式
         */
        public static final String EMAIL = "^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$";

        /**
         * 整数的正则表达式
         */
        public static final String NUMBER = "^[0-9]*$";

        /**
         * 整数和小数的正则表达式,最多10位小数
         */
        public static final String DECIMAL = "^[0-9]+(\\.[0-9]{1,10})?$";

        /**
         * 身份证号的正则表达式
         */
        public static final String IDCARDNUMBER = "(^[0-9]{15}$)|(^[0-9]{18}$)|(^[0-9]{17}(|X|x)$)";
    }

    /**
     * 正则表达式
     */
    interface Captcha {

        /**
         * 短信验证码 在 redis 中的失效时间
         */
        int CAPTCHA_TIMEOUT = 5;
    }

}
